#ifndef DATA_CHANNEL_H_
#define DATA_CHANNEL_H_

#include "link.h"

enum mode {
	PASSIVE,
	ACTIVE
};

enum {
	DATA_DISCONNECTED = -2,
	DATA_ERROR = -1,
	DATA_SUCCESS = 0,
	DATA_ABORTED = 1
};

typedef void (*on_handshaked) (link_t* ctrl, int mode, void* arg, int* abort);

int data_setup_master(link_t* ctrl, link_t* data, int mode, on_handshaked fp_handshaked, void* arg);

int data_setup_slave(link_t* ctrl, link_t* data, on_handshaked fp_handshaked, void* arg);

int data_send(link_t* data, char* buffer, int size);

int data_receive(link_t* data, char* buffer, int size, int* received);

#endif /* DATA_CHANNEL_H_ */
